//package com.example.springbootdemo.config;
//
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
//import org.springframework.security.config.annotation.web.builders.HttpSecurity;
//import org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration;
//import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
//import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
//import org.springframework.security.crypto.password.NoOpPasswordEncoder;
//import org.springframework.security.crypto.password.PasswordEncoder;
//
////@Configuration
//public class MyWebSecurityConfig extends WebSecurityConfigurerAdapter {
//    @Bean
//    PasswordEncoder passwordEncoder(){
//        return new BCryptPasswordEncoder(10);
//    }
//
//    @Override
//    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
//        auth.inMemoryAuthentication()
//                .withUser("root").password("$2a$10$9QG9c26OaR9dFlAWPvv/leLh32623iR/dG1.AZONDeLmm3smP2Nxu").roles("ADMIN", "DBA")
//                .and()
//                .withUser("admin").password("$2a$10$9QG9c26OaR9dFlAWPvv/leLh32623iR/dG1.AZONDeLmm3smP2Nxu").roles("ADMIN", "USER")
//                .and()
//                .withUser("tom").password("$2a$10$9QG9c26OaR9dFlAWPvv/leLh32623iR/dG1.AZONDeLmm3smP2Nxu").roles("USER");
//    }
//
//    @Override
//    protected void configure(HttpSecurity http) throws Exception {
//        http.authorizeRequests()
//                .antMatchers("/poi/**")
//                .hasRole("ADMIN")
//                .antMatchers("/users/**")
//                .access("hasAnyRole('ADMIN', 'USER')")
//                .anyRequest()
//                .authenticated()
//                .and()
//                .formLogin()
//                .loginProcessingUrl("/login")
//                .permitAll()
//                .and()
//                .csrf()
//                .disable();
//    }
//}
